class Calculator{ 
    def calculate(a: Int, b: Int,str: Char):Any=str  match {
        case  '+' => a + b 
        case '-'=> a - b
        case  '*'=> a * b
        case  '/'=> a / b 
        case _ => "Invalid operator" 
        }
}

val calculator = new Calculator()
println(calculator.calculate(10,5,'+')) //输出15
println(calculator.calculate(10,5,'-')) //输出5
println(calculator.calculate(10,5,'*')) //输出50
println(calculator.calculate(10,5,'/')) //输出2
println(calculator.calculate(10,5,'%')) //输出“Invalid operator
